package com.yupi.mybi.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yupi.mybi.model.entity.Chart;
import com.yupi.mybi.service.ChartService;
import com.yupi.mybi.mapper.ChartMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 *
 */
@Service
public class ChartServiceImpl extends ServiceImpl<ChartMapper, Chart>
    implements ChartService{

    @Autowired
    private ChartMapper chartMapper;

    @Override
    public List<Chart> getStatusAndFailed() {
        LocalDateTime now = LocalDateTime.now();
        LocalDateTime time = now.minusMinutes(5);
        LambdaQueryWrapper<Chart> queryWrapper = new LambdaQueryWrapper<Chart>();
        queryWrapper.lt(Chart::getCreateTime, time);
        queryWrapper.ne(Chart::getStatus,"succeed");
        return this.list(queryWrapper);
    }
}




